<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>I/O操作：计算机的读写魔法</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-gradient::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: float 20s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translate(0, 0) rotate(0deg); }
            50% { transform: translate(-30px, -30px) rotate(180deg); }
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(10px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .feature-card {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .feature-card::before {
            content: '';
            position: absolute;
            top: -100%;
            left: -100%;
            width: 300%;
            height: 300%;
            background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
            transform: rotate(45deg);
            transition: all 0.6s ease;
        }
        
        .feature-card:hover::before {
            top: -50%;
            left: -50%;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }
        
        .icon-wrapper {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            margin-bottom: 1rem;
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .highlight-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-weight: 600;
        }
        
        .list-item {
            position: relative;
            padding-left: 2rem;
            margin-bottom: 1.5rem;
        }
        
        .list-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0.5rem;
            width: 20px;
            height: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .list-item::after {
            content: '✓';
            position: absolute;
            left: 5px;
            top: 0.35rem;
            color: white;
            font-size: 12px;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-4">
        <div class="max-w-6xl mx-auto text-center relative z-10">
            <div class="mb-8">
                <i class="fas fa-magic text-6xl mb-6 animate-pulse"></i>
            </div>
            <h1 class="text-5xl md:text-6xl font-bold mb-6 leading-tight">
                I/O操作：计算机的读写魔法
            </h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                在计算机的世界中，有一种神奇的魔法让数据在硬盘和内存之间流动，让我们一同揭开这项神秘技术的面纱，开启一场数字的冒险之旅。
            </p>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-4 py-12">
        <!-- Introduction Card -->
        <div class="content-card rounded-2xl p-8 md:p-12 mb-12">
            <div class="prose prose-lg max-w-none">
                <p class="text-gray-700 leading-relaxed text-lg">
                    在计算机的世界中，I/O（输入/输出）操作就像是计算机的读写魔法，让我们轻松穿越数字的大门，畅游于信息的海洋。这项技术使得计算机能够与外部世界进行信息交互，是数字世界中最基础也是最重要的能力之一。
                </p>
            </div>
        </div>

        <!-- What is I/O Section -->
        <div class="content-card rounded-2xl p-8 md:p-12 mb-12">
            <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">什么是I/O操作？</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="space-y-6">
                    <p class="text-gray-700 leading-relaxed">
                        I/O指的是输入（Input）和输出（Output），是计算机与外部世界进行信息交互的方式。就像人类通过眼睛接收信息、通过嘴巴表达想法一样，计算机通过I/O操作实现与外界的沟通。
                    </p>
                    <div class="bg-purple-50 p-6 rounded-xl">
                        <h3 class="font-semibold text-purple-800 mb-3 flex items-center">
                            <i class="fas fa-keyboard mr-3"></i>输入操作
                        </h3>
                        <p class="text-purple-700">从外部获取数据：键盘输入、鼠标点击、文件读取等</p>
                    </div>
                    <div class="bg-indigo-50 p-6 rounded-xl">
                        <h3 class="font-semibold text-indigo-800 mb-3 flex items-center">
                            <i class="fas fa-desktop mr-3"></i>输出操作
                        </h3>
                        <p class="text-indigo-700">向外部传送数据：屏幕显示、文件写入、打印输出等</p>
                    </div>
                </div>
                <div class="flex items-center justify-center">
                    <div class="mermaid">
                        graph TD
                        A[计算机核心] -->|输出| B[显示器]
                        A -->|输出| C[硬盘]
                        A -->|输出| D[打印机]
                        E[键盘] -->|输入| A
                        F[鼠标] -->|输入| A
                        G[文件系统] -->|输入| A
                        style A fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
                        style B fill:#f5f7fa,stroke:#667eea,stroke-width:2px
                        style C fill:#f5f7fa,stroke:#667eea,stroke-width:2px
                        style D fill:#f5f7fa,stroke:#667eea,stroke-width:2px
                        style E fill:#f5f7fa,stroke:#764ba2,stroke-width:2px
                        style F fill:#f5f7fa,stroke:#764ba2,stroke-width:2px
                        style G fill:#f5f7fa,stroke:#764ba2,stroke-width:2px
                    </div>
                </div>
            </div>
        </div>

        <!-- I/O Types Section -->
        <div class="content-card rounded-2xl p-8 md:p-12 mb-12">
            <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">I/O操作的基本方式</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="feature-card p-8 rounded-xl">
                    <div class="icon-wrapper">
                        <i class="fas fa-pause-circle text-white text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4 text-gray-800">同步I/O</h3>
                    <p class="text-gray-700 mb-4">
                        就好比你在等待电梯的时候，必须一直站在那里直到电梯来了。同步I/O是一种阻塞的方式，程序必须等待I/O操作完成后才能继续执行。
                    </p>
                    <div class="bg-white bg-opacity-70 p-4 rounded-lg">
                        <p class="text-sm text-gray-600">
                            <i class="fas fa-info-circle mr-2 text-purple-600"></i>
                            特点：简单直观，但可能造成程序等待
                        </p>
                    </div>
                </div>
                <div class="feature-card p-8 rounded-xl">
                    <div class="icon-wrapper">
                        <i class="fas fa-play-circle text-white text-2xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4 text-gray-800">异步I/O</h3>
                    <p class="text-gray-700 mb-4">
                        异步I/O则好比你按下电梯按钮后，可以继续做其他事情，不必一直等待。这是一种非阻塞的方式，程序可以在I/O操作进行的同时执行其他任务。
                    </p>
                    <div class="bg-white bg-opacity-70 p-4 rounded-lg">
                        <p class="text-sm text-gray-600">
                            <i class="fas fa-info-circle mr-2 text-purple-600"></i>
                            特点：效率更高，但编程复杂度增加
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Why I/O Section -->
        <div class="content-card rounded-2xl p-8 md:p-12 mb-12">
            <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">为什么需要I/O操作？</h2>
            <div class="space-y-6">
                <div class="list-item">
                    <h3 class="text-xl font-semibold mb-2 highlight-text">数据交互</h3>
                    <p class="text-gray-700">I/O操作使得计算机能够与外部设备、文件系统等进行数据交互，实现信息的输入和输出，构建起数字世界与现实世界的桥梁。</p>
                </div>
                <div class="list-item">
                    <h3 class="text-xl font-semibold mb-2 highlight-text">持久化存储</h3>
                    <p class="text-gray-700">通过I/O操作，计算机能够将数据写入硬盘，实现数据的持久化存储，就如同把信息记录在一本永不褪色的数字日记中。</p>
                </div>
                <div class="list-item">
                    <h3 class="text-xl font-semibold mb-2 highlight-text">用户交互</h3>
                    <p class="text-gray-700">键盘、鼠标等设备通过I/O操作将用户的输入传递给计算机，实现用户与计算机的交互，开启人机对话的新纪元。</p>
                </div>
            </div>
        </div>

        <!-- Magic of I/O Section -->
        <div class="content-card rounded-2xl p-8 md:p-12 mb-12">
            <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">I/O操作的奇妙之处</h2>
            <div class